@include('backstage/public/_header')
    <!--結果頁快捷搜索框 開始-->
    <div class="search_wrap">
        <form action="index" method="get">
            <table class="search_tab">
                <tr>
                    <th width="70">關鍵字:</th>
                    <td><input type="text" name="keywords" placeholder="用護名", value="@if(isset($_GET['keywords'])){{$_GET['keywords']}}@endif"></td>
                    <td><input type="submit" name="sub" value="查詢"></td>
                </tr>
            </table>
        </form>
    </div>
    <!--結果頁快捷搜索框 結束-->

    <!--搜索結果頁面 列表 開始-->
    <div class="result_wrap">
        <div class="result_content">
            <table class="list_tab">
                <tr>
                    <th class="tc">ID</th>
                    <th>用護ID</th>
                    <th>用護名</th>
                    <th>昵稱</th>
                    <th>充值金額</th>
                    <th>充值狀態</th>
                    <th>當前余額</th>
                    <th>發生時間</th>
                    <th>完成時間</th>
                    <th>操作</th>
                </tr>
                @foreach ($list as $vb)
                    <tr id="list_{{$vb->id}}">
                        <td class="tc">{{$vb->id}}</td>
                        <td class="tc">{{$vb->uid}}</td>
                        <td class="tc"><a href="javascript:void(0);" onclick="openRim('{{$vb->uid}}','{{$vb->user_name}}');">{{$vb->user_name}}</a></td>
                        <td class="tc">{{$vb->nickname}}</td>
                        <td class="tc">{{$vb->money}}</td>
                        <td class="tc">@if($vb->status==0) <span style="color: #f2b512;">{{$recharge_status[$vb->status]}}</span> @elseif($vb->status==1) <span style="color: darkgreen;">{{$recharge_status[$vb->status]}}</span> @elseif($vb->status==2)  <span style="color: darkred;">{{$recharge_status[$vb->status]}}</span> @endif</td>
                        <td class="tc">{{$vb->account_money}}</td>
                        <td>@if($vb->add_time!=0) {{date('Y-m-d H:i:s',$vb->add_time)}} @endif</td>
                        <td>@if($vb->time_end!=0) {{date('Y-m-d H:i:s',$vb->time_end)}} @endif</td>
                        <td>
                            @if($vb->status!=1)<a href="edit/{{$vb->id}}">審核</a>@endif
                            <a href="javascript:void(0);" onclick="del({{$vb->id}});">刪除</a>
                        </td>
                    </tr>
                @endforeach
            </table>
        </div>
        <div class="page_nav">
            {{ $list->links('vendor/pagination/default', ['foo' => 'bar']) }}
        </div>
    </div>
    <!--搜索結果頁面 列表 結束-->
    <script type="text/javascript">
        //刪除
        function del(aid){
            aid = aid ? aid : getChecked();
            // console.log(aid);
            //詢問框
            layer.confirm('刪除後不可恢復，確定要刪除嗎？', {
              btn: ['確定','取消'] //按鈕
            }, function(){
                aid = aid.toString();
                // console.log(aid);
                if(aid == '') return layer.msg('未選中任何數據', {icon: 2,anim: 6});
                // layer.msg('正在刪除...', {icon: 16,shade: 0.01});
                $.post("{{$dodel}}", { 'idstr':aid,"_token":"{{ csrf_token() }}"},
                function (data){
                    if(data.status==1){
                        layer.msg('正在刪除...', {icon: 16,shade: 0.01});
                        setTimeout(function(){
                            aid = aid.split(',');
                            $.each(aid, function(i,n){
                                $('#list_'+n).remove();
                            });
                            layer.msg(data.message, {icon: 1});
                        },2000);
                    }else if(data.status==0){
                        layer.msg(data.message, {icon: 2});
                    }else if(data.status==2){
                        layer.msg(data.message, {icon: 7});
                    }else if(data.status==-1){
                        layer.alert(data.message, {icon: 2,anim:6});
                    }else{
                        layer.msg('未知原因，刪除失敗', {icon: 2});
                    }
                }, "json");
            }, function(){
              // layer.msg('未做任何操作', {
              //   time: 20000, //20s後自動關閉
              //   btn: ['明白了', '知道了']
                // layer.msg('未做任何操作', {icon: 2});
            });
            
        }
        // 打開查看用戶詳細信息
        function openRim(id,name){
            layer.open({
              type: 2,
              title:name+'-詳細信息',
              skin: 'layui-layer-rim', //加上邊框
              area: ['1000px', '500px'], //寬高
              content: ['/backstage/common/user/'+id,'no']
            });
        }
    </script>
@include('backstage/public/_footer')